<%-- 
    Document   : Modulo1Main
    Created on : 07-oct-2011, 6:19:13
    Author     : PC-01
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>

<%
    Connection conn = null;
    try {
        String sc = "jdbc:mysql://localhost:3306/upeu?user=root&password=";
        Class.forName("com.mysql.jdbc.Driver");
        conn = DriverManager.getConnection(sc);
        System.out.println("Conectado");%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <form action="Modulo1Save.jsp">
            <h2 align="center">
                 Examen de LP1</h2><br>
            <h3><br>
            </h3>
            <table width="267" border="0" align="center">
                <tr>
                    <th colspan="2" bgcolor="#B8AA03" scope="col">Registrar Nuevo</th>
                </tr>
                <tr>
                    <td width="113" align="right" bgcolor="#DDDD00">Photo  :</td>
                    <td width="144" bgcolor="#DDDD00"><input type="text" name="Photo  " id="Photo  "/></td>
                </tr>
                <tr>
                    <td align="right" bgcolor="#DDDD00">`Name` :</td>
                    <td bgcolor="#DDDD00"><input type="text" name="`Name` " id="`Name` "/></td>
                </tr>
                <tr>
                    <td align="right" bgcolor="#DDDD00">Email :</td>
                    <td bgcolor="#DDDD00"><input type="text" name="Email " id="Email "></td>
                </tr>
                <tr>
                    <td align="right" bgcolor="#DDDD00">Cellular:</td>
                    <td bgcolor="#DDDD00"><input type="text" name="Cellular" id="Cellular"></td>
                </tr>
                <tr>
                    <td align="right" bgcolor="#DDDD00">Login :</td>
                    <td bgcolor="#DDDD00"><input type="text" name="Login " id="Login "></td>
                </tr>
                 <tr>
                    <td align="right" bgcolor="#DDDD00">Password :</td>
                    <td bgcolor="#DDDD00"><input type="text" name="Password " id="Password "></td>
                </tr>
                 <tr>
                    <td align="right" bgcolor="#DDDD00">Privilege :</td>
                    <td bgcolor="#DDDD00"><input type="text" name="Privilege " id="Privilege "></td>
                </tr>
                 <tr>
                    <td align="right" bgcolor="#DDDD00">ActiveAccount :</td>
                    <td bgcolor="#DDDD00"><input type="text" name="Login " id="ActiveAccount "></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="2"><label for="textfield">
                            <input type="submit" value="Guardar"/>
                        </label></td>
                </tr>
            </table>
        </form>
        --- 
        <table width="549" border="0" align="center">         
            <tr>
                <th colspan="8" bgcolor="#00DFDF" scope="col">Reporte de Tabla</th>
            </tr>
            <tr>
                <th width="42" bgcolor="#66FFFF" scope="col">Nro.</th>
                <th width="105" bgcolor="#66FFFF" scope="col">Photo  </th>
                <th width="120" bgcolor="#66FFFF" scope="col">`Name` </th>
                <th width="80" bgcolor="#66FFFF" scope="col">Email </th>
                <th width="80" bgcolor="#66FFFF" scope="col">Cellular</th>
                <th width="80" bgcolor="#66FFFF" scope="col">Login </th>
                 <th width="80" bgcolor="#66FFFF" scope="col">Password</th>
                  <th width="80" bgcolor="#66FFFF" scope="col">Privilege</th>
                   <th width="80" bgcolor="#66FFFF" scope="col">ActiveAcount</th>
                <th colspan="2" bgcolor="#66FFFF" scope="col">Opciones:</th>
            </tr>
            
            <%  int x = 1;
                String qry = "select * from `User`";
                PreparedStatement ps = conn.prepareStatement(qry);
                ResultSet rs = ps.executeQuery();
                while (rs.next()) {%>
            <tr bgcolor="#E8FFFF" >
                <th ><%= x++%></th>
                <th ><%= rs.getString("Photo  ")%></th>
                <th ><%= rs.getString("`Name` ")%></th>
                <th ><%= rs.getString("Email ")%></th>
                <th ><%= rs.getString("Cellular")%></th>
                <th ><%= rs.getString("Login ")%></th>
                  <th ><%= rs.getString("Password")%></th>
                    <th ><%= rs.getString("Privilege")%></th>
                      <th ><%= rs.getString("ActiveAccount")%></th>
                <th width="80" ><a  href=Modulo1Remove.jsp?`User`id=<%= rs.getString("`User`id")%>>Eliminar</a>  </th>
                <th width="80" ><a  href=Modulo1Update.jsp?`User`id=<%= rs.getString("`User`id")%>>Modificar</a> </th>
            </tr>
            <%
                    }
                } catch (Exception e) {
                    out.print("Error: " + e.getMessage());
                }
            %>  
        </table>


    </body>
</html>
